 <script>
	const url = 'https://api.isaim.cn/citizenry/citizen/'

	const that = {
		methods:{
			request({url, field, name='get', method='GET', data={}, ok=(res)=>{}, fail=(msg)=>{}, token=''}){
				uni.request({
					header:{
						Authorization: 'Bearer ' + this.globalData.token || token,
					},
					url,
					method,
					data,
					success: res => {
						const {data} = res
						if(data.code==200){
							const {d} = data
							field[name] = d
							ok || ok(d);
						}else if(data.code==500){
							uni.showToast({
								icon:'none',
								title: data.message,
							});
							fail || fail(data.message)
						}
					},
					fail: (err) => {console.error(err)},
				});
			}
		},
		onLaunch: async function() {
			
		},
		onShow: function() {
			console.log('App Show');
		},
		onHide: function() {
			console.log('App Hide');
		},
		globalData: {
			url: 'https://api.isaim.cn/citizenry/citizen/',
			curl: 'https://api.isaim.cn/citizenry/',
			furl: 'https://api.isaim.cn/citizenry/file/',
			adurl: 'https://api.isaim.cn/court/',
			returns: {},
			cards: [

			],
			// 水表卡信息
			card: {
				name: '', // 户名
				no: '', // 水表卡编号
				addr: '', // 地址
				type: '个人', // 用水类型
			},
			pcode:'',
			token: uni.getStorageSync('token'),
			code: uni.getStorageSync('code'),
			phone: uni.getStorageSync('phone'),
			// 登录信息
			logined: uni.getStorageSync('logined'),
			userInfo: uni.getStorageSync('userInfo'),
			// 认证信息
			authed: uni.getStorageSync('authed'),
			auth: uni.getStorageSync('auth'),
		},
		filters: {
			securityName(name) {
				return name[0] + '*' + name[name.length - 1]
			},
			securityCard(card) {
				return card.substr(0, 6) + '*'.repeat(6)
			},
			
			smartTime(date, fmt){
				let ret;
				date = new Date(date)
				const opt = {
					"Y+": date.getFullYear().toString(),        // 年
					"m+": (date.getMonth() + 1).toString(),     // 月
					"d+": date.getDate().toString(),            // 日
					"H+": date.getHours().toString(),           // 时
					"M+": date.getMinutes().toString(),         // 分
					"S+": date.getSeconds().toString()          // 秒
					// 有其他格式化字符需求可以继续添加，必须转化成字符串
				};
				for (let k in opt) {
					ret = new RegExp("(" + k + ")").exec(fmt);
					if (ret) {
						fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
					};
				};
				return fmt;
			}
		}
	}

	export default that;
</script>

<style>
	
	.no-records-icon{
		width:100rpx;
	}
	/* 解决头条小程序组件内引入字体不生效的问题 */
	/* #ifdef MP-TOUTIAO */
	@font-face {
		font-family: uniicons;
		src: url('/static/uni.ttf');
	}

	/* #endif */
	page {
		background: #F4F4F8;
		box-sizing: border-box;
		padding: 25rpx;
		--layer-bottom: 10000;
		--layer-mask: 100000;
		--layer-prompt: 100001;
		--color-cancel: #7985A1;
		--color-ok: #2E62E2;
		--color-page: #F4F4F8;
	}
	
	.will{
		color: #F68D1C;
	}
	
	.ing{
		color: #0DB07C;
	}
	
	.ed{
		color: #2E62E2;
	}
	
	button::after {
	  border: none;
	}
	
	button.btn{
		background: none;
		background-color: transparent;
		border: none;
		border-radius: 0;
		line-height: 1em;
		padding: 0;
		margin: 0;
	}
	
	.btn-icon{
		width: 62rpx;
		height: 62rpx;
		overflow: hidden;
	}

	.required>.cell-title:before{
		content: '*'!important;
		color: red;
	}

	.field{
		/* 布局问题 */
		display: flex;
		flex-direction: row;
		flex-wrap: nowrap;
		justify-content: space-between;
		align-items: center;
		text-align: left;
		padding: 1rem 0;
		
		/* 边框问题 */
		border-top: solid 1px gray;
		border-bottom: solid 1px gray;
		margin-bottom: -1px;
	}
	
	/* 分割线 */
	.splitter{
		display: block;
		height: 0;
		border-top: solid 1px #DFDFDD;
		margin: 0.5em 0;
	}
	
	.field-title{
		/* 字体 */
		font-weight: bold;
		color: #000000;
		
		flex-grow: 0;
		flex-shrink: 0;
		width: 200rpx;
		max-width: 200rpx;
		min-width: 200rpx;
		flex-basis: 200rpx;
		
		text-align: left;
		
		text-overflow: ellipsis;
	}
	
	.field-content{
		border: none;
		background: transparent;
		
		text-align: left;
		
		height: max-content;
		
		flex-grow: 1;
		flex-shrink: 1;
	}
	
	.field-right{
		font-size: small;
		color: gray;
		text-align: right;
		
		flex-grow: 0;
		flex-shrink: 0;
		width: max-content;
	}
	
	
	.btn-text{
		font-size: 28rpx;
		font-family: Alibaba PuHuiTi;
		font-weight: 400;
		color: #5E6677;
	}
	
	.litem{
		background-color: white;
		padding: 32rpx;
		border-radius: 10px;
		margin-top: 20rpx;
		margin-bottom: 20rpx;
		display: flex;
		flex-direction: column;
		flex-wrap: nowrap;
		justify-content: space-between;
	}
	
	.cell{
		height: auto;
		background: #FFFFFF;
		border-radius: 10px;
		padding: 32rpx;
		margin-top: 20rpx;
		margin-bottom: 20rpx;
		box-sizing: border-box;
		line-height: 36rpx;
		display: flex;
		flex-direction: row;
		flex-wrap: nowrap;
		align-items: center;
	}
	
	title, .title{
		display: block;
		text-align: center;
		font-weight: bold;
		font-size: large;
	}
	
	.cell-title{
		font-size: 32rpx;
		font-family: Alibaba PuHuiTi;
		font-weight: bold;
		color: #111111;
		flex-grow: 0;
		flex-shrink: 0;
		width: 160rpx;
		margin-right: 20rpx;
	}
	
	.cell-content{
		flex-grow: 1;
		flex-shrink: 1;
		border: none;
		background: transparent;
		text-align: left;
	}
	
	.placeholder{
		font-size: small;
		font-family: Alibaba PuHuiTi;
		color: #C5C5C5;
		line-height: 36rpx;
	}

	/* 底部布局 */
	.bottom {
		position: fixed;
		left: 0;
		width: 750rpx;
		bottom: 0;
		z-index: 999999;
		padding: 20rpx;
		box-sizing: border-box;
		background-color: #F4F4F8;
	}

	.card {
		background-color: white;
		border-radius: 10rpx 10rpx;
		padding: 20rpx;
		box-sizing: border-box;
		margin: 20rpx 0;
	}

	/* 圆形外观 */
	.circle {
		display: inline-block;
		border-radius: 50% 50%;
		overflow: hidden;
		box-sizing: border-box;
	}
	
	/* 弹出遮罩层 */
	.mask{
		position: absolute;
		box-sizing: border-box;
		left: 0;
		top: 0;
		width: 750rpx;
		height: 100%;
		background-color: rgba(0,0,0,0.5);
	}
	
	/* 弹出框 */
	.prompt{
		position: absolute;
		z-index: 9999;
		background: white;
		top: 50%;
		left: 50%;
		width: 700rpx;
		box-sizing: border-box;
		height: auto;
		transform: translate(-50%, -50%);
		padding: 30rpx;
	}

	.capsule {
		display: inline-block;
		border-radius: 999em;
		border: none!important;
	}
	
	.btn-capsule{
		display: block;
		border-radius: 999em;
		border: none;
		background-color: #007AFF;
		margin: 20rpx;
		color: white;
	}

	/* 中央布局 */
	.center {
		position: absolute;
		left: 50%;
		top: 50%;
		transform: translate(-50%, -50%);
	}
	
	/* 绝对中央布局 */
	.abscenter{
		position: fixed;
		left: 50%;
		top: 50vh;
		transform: translate(-50%, -50%);
	}

	/* 面板 */
	.panel {
		position: relative;
		display: inline-block;
		width: 100%;
		height: 100%;
		background-color: white;
		border-radius: 10rpx;
		padding: 20rpx;
		box-sizing: border-box;
	}

	/* 竖直布局 */
	.vertical {
		display: flex;
		flex-direction: column;
		flex-wrap: nowrap;
		align-items: center;
		justify-content: space-between;
		overflow-y: scroll;
		overflow-x: hidden;
		text-align: center;
	}

	/* 水平布局 */
	.horizontal {
		display: flex;
		flex-direction: row;
		flex-wrap: nowrap;
		align-items: center;
		justify-content: space-between;
		overflow-x: scroll;
		overflow-y: hidden;
	}
	
	.scale{
		flex-grow: 1;
		flex-shrink: 1;
	}
	
	.submit{
		border-radius: 999em;
		color: white;
		background-color: #2E62E2;
		position: absolute;
		bottom: 0;
		margin: 25rpx;
		width: 700rpx;
		display: block;
		box-sizing: border-box;
	}

	/* 换行布局 */
	.wrap {
		flex-wrap: wrap;
	}

	/* 顶部布局 */
	.top {
		position: fixed;
		left: 0;
		width: 750rpx;
		top: 0;
		display: flex;
		flex-direction: row;
		flex-wrap: nowrap;
		align-items: stretch;
	}

	.gst {
		font-size: small;
		color: gray;
	}
	
	.table{
		display: table;
		width: 100%;
		text-align: center;
	}
	
	.table>.thead{
		display: table-header-group;
	}
	
	.table>.tbody{
		display: table-row-group;
	}
	
	.table>.tfoot{
		display: table-footer-group;
	}
	
	.table .tr{
		display: table-row;
	}
	
	.table .th{
		display: table-cell;
		font-weight: bold;
	}
	
	.table .td{
		display: table-cell;
	}
	
	/* 兼容H5标签 */
	table{
		display: table;
		text-align: center;
	}
	
	table > caption{
		display: table-caption;
		text-align: center;
		font-weight: bold;
	}
	
	table > thead{
		display: table-header-group;
	}
	
	table>tbody{
		display: table-row-group;
	}
	
	table>tfoot{
		display: table-footer-group;
	}
	
	table tr{
		display: table-row;
	}
	
	table th{
		font-weight: bold;
		display: table-cell;
	}
	
	table td{
		display: table-cell;
	}
	
	table tc{
		display: table-column;
	}
	
	table>tcg{
		display: table-column-group;
	}
	
	caption{
		display: inline-block;
		width: 100%;
		text-align: center;
		font-weight: bold;
	}
	
	center, .center{
		display: block;
		text-align: center;
		margin: auto;
		vertical-align: middle;
		justify-content: center;
		align-items: center;
	}
	
	center > text{
		text-align: center;
	}
	
	center > * {
		display: inline-block;
		margin: auto;
	}
</style>
